from algorithm import Algorithm

class ColorEnhancement(Algorithm):
    def __init__(self):
        super(ColorEnhancement)
        self.factor = 1.0
    def perform_action(self):
        for i in range(len(self.pixels)):
            for j in range(len(self.pixels[i])):
                r = self.pixels[i][j][0]
                g = self.pixels[i][j][1]
                b = self.pixels[i][j][2]
                r2 = int(r + self.factor*((r-g) + (r-b))/2)
                g2 = int(g + self.factor*((g-r) + (g-b))/2)
                b2 = int(b + self.factor*((b-r) + (b-g))/2)
                self.pixels[i][j] = (r2, g2, b2)
            
    